home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Financial / QTax1.1 / Source / RegularObject.m < prev   
Text File  |  1995-06-12  |  1KB  |  64 lines

  1.  
  2. #import "RegularObject.h"
  3.  
  4. @implementation RegularObject
  5.  
  6. - Calc:sender
  7. {
  8.  
  9.     char dummyString[20];
  10.     float price;
  11.     float tps;
  12.     float subtotal;
  13.     float tvq;
  14.     float total;
  15.  
  16.  
  17.     price = [Price floatValue];
  18.  
  19.     tps = (price*0.07);
  20.  
  21.         subtotal = (price+tps);
  22.  
  23.         tvq = (subtotal*0.065);
  24.  
  25.         total = (subtotal+tvq);
  26.  
  27.     sprintf(dummyString, "$%.2f", tps); // Convert float to a string
  28.     [TPS setStringValue:dummyString];// Display result
  29.     [TPS display];
  30.  
  31.     sprintf(dummyString, "$%.2f", subtotal); // Convert float to a string
  32.     [SubTotal setStringValue:dummyString];// Display result
  33.     [SubTotal display];
  34.  
  35.     sprintf(dummyString, "$%.2f", tvq); // Convert float to a string
  36.     [TVQ setStringValue:dummyString];// Display result
  37.     [TVQ display];
  38.          
  39.     sprintf(dummyString, "$%.2f", total); // Convert float to a string
  40.     [Total setStringValue:dummyString];// Display result
  41.     [Total display];
  42.  
  43.     [Price selectText:self];
  44.  
  45.     return self;
  46. }
  47.  
  48. // AWAKEFROMNIB
  49. // This is one of the last methods executed after the nib file is loaded.
  50. // This is the BEST way I know how to initialize an object and jump into
  51. // a method after the nib file was loaded, because you are all the methods
  52. // and variables needed can be used. (Unlike init which is not compeletly
  53. // ready when that message is sent
  54. - awakeFromNib
  55. {
  56.  
  57.     [RegularPanel makeKeyAndOrderFront:NULL];
  58.     [Price selectText:self];
  59.  
  60.         return self;
  61. }
  62.  
  63. @end
  64.